
#
# Project Properties
#
CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
PROJECT (PushDemo)
SET (APPLICATION_NAME "PushDemo")
SET (APPLICATION_CODENAME "${PROJECT_NAME}")
SET (APPLICATION_COPYRIGHT_YEARS "2013")
SET (APPLICATION_VERSION_MAJOR 1)
SET (APPLICATION_VERSION_MINOR 0)
SET (APPLICATION_VERSION_PATCH 0)
SET (APPLICATION_VERSION_TYPE SNAPSHOT)
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}")
SET (APPLICATION_VENDOR_ID "com.cfood")
SET (APPLICATION_VENDOR_NAME "cfood")
SET (APPLICATION_VENDOR_URL "www.cfood.com")
SET (APPLICATION_ID "${APPLICATION_VENDOR_ID}.${PROJECT_NAME}")

SET(CXX_FLAGS
 -g
 -rdynamic
 -fPIC
 -Wall
 -Wextra
 -Werror
 -Woverloaded-virtual
 -Wpointer-arith
 -Wwrite-strings
 -Wno-unused-parameter
 -Wno-reorder
 -Wno-unused-variable
 -DVALGRIND
 -D_FILE_OFFSET_BITS=64
 -DHAVE_STDINT_H
-DHAVE_INTTYPES_H
-DHAVE_CONFIG_H
 -DHAVE_NETINET_IN_H
 )

STRING(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")

#
# Project Output Paths
#
SET (MAINFOLDER ${PROJECT_SOURCE_DIR})
MESSAGE("main folder ${MAINFOLDER}")
SET (EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin")
SET (LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib")

#
# Project Search Paths
#
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/gen-cpp")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/client")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/common")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/server")
INCLUDE_DIRECTORIES("${MAINFOLDER}")
# for thrift "config.h" which is included by thrift/concurrency/thread.h
INCLUDE_DIRECTORIES("/usr/local/include/thrift")


FIND_PACKAGE(Boost REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})

FIND_LIBRARY(GLOG_LIBRARY NAMES glog)
FIND_LIBRARY(GFLAGS_LIBRARY NAMES gflags)
FIND_LIBRARY(THRIFT_LIBRARY NAMES thrift)
FIND_LIBRARY(THRIFTNB_LIBRARY NAMES thriftnb)
FIND_LIBRARY(BOOST_SYSTEM_LIBRARY NAMES boost_system)
FIND_LIBRARY(BOOST_THREAD_LIBRARY NAMES boost_thread)
FIND_LIBRARY(LIBEVENT_LIBRARY NAMES event)

LINK_LIBRARIES(${THRIFT_LIBRARY} ${THRIFTNB_LIBRARY}
  ${BOOST_SYSTEM_LIBRARY} ${BOOST_THREAD_LIBRARY}
  ${GLOG_LIBRARY} ${GFLAGS_LIBRARY}
  ${LIBEVENT_LIBRARY}
  pthread)

SET(common_SRC gen-cpp/ChatService.cpp gen-cpp/ChatService_constants.cpp gen-cpp/ChatService_types.cpp)
SET(client_SRC  client/Client.cc client/RequestQueue.cc client/ChatServiceClientHandler.cc ${common_SRC})
MESSAGE("client src: ${client_SRC}")
ADD_EXECUTABLE(client ${client_SRC})
SET(server_SRC server/Server.cc server/EmptyResponser.cc server/ChatServiceServerHandler.cc server/TNonblockingPushServer.cc ${common_SRC})
MESSAGE("server src: ${server_SRC}")
ADD_EXECUTABLE(server ${server_SRC})



